package com.ayf.payment.game.api.task.autoReissue;

import com.swwx.charm.zookeeper.exception.GetLockFailedException;
import com.swwx.charm.zookeeper.lock.DistributedLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

//@Component
public class GoodAutoReissueTask extends GoodAutoReissueTaskImpl {

    @Autowired
    protected DistributedLock distributedLock;

    @Autowired
    protected TaskExecutor goodAutoReissueTask;

    //每1分钟执行一次
    //@Scheduled(cron = "0 */1 * * * ?")
    public void run() throws GetLockFailedException {
        super.run(distributedLock);
    }

    @Override
    public void submit(Runnable task) {
        goodAutoReissueTask.execute(task);
    }
}
